package ym.ecrm.core.domain.salesManagement;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import ym.ecrm.core.domain.base.BaseEntity;
import ym.ecrm.core.domain.customerManagement.Customer;
import ym.ecrm.core.domain.salesManagement.Contract;
import ym.ecrm.core.domain.systemManagement.User;

/**
 * 订单
 * 
 * @author Princess
 * @version 1.0
 */
@Entity
@Table(name="t_order")
public class Order extends BaseEntity{
	/**
	 * 订单编号
	 */
	private String orderCode;
	/**
	 * 订单名称
	 */
	private String orderName;
	/**
	 * 对应客户（合作伙伴、企业客户、个人客户）
	 */
	@ManyToOne
	private Customer customer;
	/**
	 * 对应销售机会
	 */
	@OneToOne
	private SalesOpportunity salesOpportunity;
	/**
	 * 对应合同
	 */
	@OneToOne
	private Contract contract;
	/**
	 * 付款方式
	 */
	private String payTyle;
	/**
	 * 订单明细
	 */
	@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
	@JoinColumn(name="Order_Detail_id")
	private Set<OrderDetail> orderDetails = new HashSet<OrderDetail>();
	/**
	 * 订单开始时间
	 */
	private Date startTime;
	/**
	 * 订单终止时间
	 */
	private Date endTime;
	/**
	 * 收货人
	 */
	private String consignee;
	/**
	 * 联系电话
	 */
	private String consigneePhoneNum;
	/**
	 * 详细地址
	 */
	private String consigneeAdress;
	/**
	 * 邮编
	 */
	private String consigneePostCode;
	/**
	 * 发货人
	 */
	private String shipper;
	/**
	 * 发货方式
	 */
	private String consignStyle;
	/**
	 * 货运商
	 */
	private String cargoAgent;
	/**
	 * 发货时间
	 */
	private Date consignTime;
	/**
	 * 订单状态
	 */
	private String orderStatus;
	/**
	 * 订单所有人
	 */
	@ManyToOne
	@JoinColumn(name="user_id")
	private User user;
	public String getOrderCode() {
		return orderCode;
	}
	public void setOrderCode(String orderCode) {
		this.orderCode = orderCode;
	}
	public String getOrderName() {
		return orderName;
	}
	public void setOrderName(String orderName) {
		this.orderName = orderName;
	}
	public Customer getCustomer() {
		return customer;
	}
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
	public SalesOpportunity getSalesOpportunity() {
		return salesOpportunity;
	}
	public void setSalesOpportunity(SalesOpportunity salesOpportunity) {
		this.salesOpportunity = salesOpportunity;
	}
	public Contract getContract() {
		return contract;
	}
	public void setContract(Contract contract) {
		this.contract = contract;
	}
	public String getPayTyle() {
		return payTyle;
	}
	public void setPayTyle(String payTyle) {
		this.payTyle = payTyle;
	}
	public Set<OrderDetail> getOrderDetails() {
		return orderDetails;
	}
	public void setOrderDetails(Set<OrderDetail> orderDetails) {
		this.orderDetails = orderDetails;
	}
	public Date getStartTime() {
		return startTime;
	}
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	public Date getEndTime() {
		return endTime;
	}
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	public String getConsignee() {
		return consignee;
	}
	public void setConsignee(String consignee) {
		this.consignee = consignee;
	}
	public String getConsigneePhoneNum() {
		return consigneePhoneNum;
	}
	public void setConsigneePhoneNum(String consigneePhoneNum) {
		this.consigneePhoneNum = consigneePhoneNum;
	}
	public String getConsigneeAdress() {
		return consigneeAdress;
	}
	public void setConsigneeAdress(String consigneeAdress) {
		this.consigneeAdress = consigneeAdress;
	}
	public String getConsigneePostCode() {
		return consigneePostCode;
	}
	public void setConsigneePostCode(String consigneePostCode) {
		this.consigneePostCode = consigneePostCode;
	}
	public String getShipper() {
		return shipper;
	}
	public void setShipper(String shipper) {
		this.shipper = shipper;
	}
	public String getConsignStyle() {
		return consignStyle;
	}
	public void setConsignStyle(String consignStyle) {
		this.consignStyle = consignStyle;
	}
	public String getCargoAgent() {
		return cargoAgent;
	}
	public void setCargoAgent(String cargoAgent) {
		this.cargoAgent = cargoAgent;
	}
	public Date getConsignTime() {
		return consignTime;
	}
	public void setConsignTime(Date consignTime) {
		this.consignTime = consignTime;
	}
	public String getOrderStatus() {
		return orderStatus;
	}
	public void setOrderStatus(String orderStatus) {
		this.orderStatus = orderStatus;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	
}
